/**
 * crawler
 *
 * outlook@China software studio
 * Copyright (c) 2008-2010. All Rights Reserved.
 * http://www.outlook.com
 */

package org.outlook.crawler.util;

import org.apache.commons.lang.StringUtils;

/**
 * function:
 * @author Watson email: watson.wu@hotmail.com
 * @date 2011
 */
public class CrawlerCacheUtil {
	
	public static String getCacheKey(String key, Long sourceId) {
		if(StringUtils.isBlank(key)) return null;
		else if(key.length()>50)
			return key.hashCode()+""+sourceId;
		else
			return key+"-"+sourceId;
	}

	public static String getCacheKey(String from, String to, Long sourceId) {
		return getCacheKey(from+to, sourceId);
	}

}
